<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="click" id="click" onclick="foo(this, 10000);"/>
<script>
  function foo(obj, time) {
    obj.disabled = true;

    setTimeout(function() {
      let x = setInterval(function () {
        time = time - 1000; //reduce each second
        obj.value = (time / 1000) % 60;
        if (String(time) === '0') {
          clearInterval(x);
          obj.value = "retry";
          obj.disabled = false;
        }
      }, 1000);
    }, time-10000);
  }
</script>
</body>

</html>